import json
import requests
from test_case import conftest

class get_company:

    # type_id = 1-> 资产公司
    # type_id = 2-> 商管公司
    # type_id = 3-> 物管公司
    def get_company_info(self, type_id):
        try:
            url = conftest.base_url + '/api-zendai/investment/e/common/selectCompanyListByType'
            data = {
                "entityTypeId": type_id,
                "mallCode": "XMBN"
            }
            result = requests.post(url, headers=conftest.fin_header, data=json.dumps(data))
            fin_result = json.loads(result.text)
            if len(fin_result['data']['records']) != None:
                return fin_result['data']['records'][0]
            else:
                return False
        except BaseException:
            return False

# a = get_company()
# print(a.get_company_info(1))
